package com.demo.testmystarter;

import com.demo.demospringbootstarter.annotation.EnableDemo;
import com.demo.demospringbootstarter.entity.DemoProperties;
import com.demo.demospringbootstarter.service.DemoService;
import com.demo.demospringbootstarter.service.TestService;
import com.demo.demospringbootstarter.util.DemoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.event.EventListener;


@SpringBootApplication
//@ComponentScans(value = { @ComponentScan(value = "com.yibai.spring.annotation"),
//        @ComponentScan(value = "com.yibai.spring.annotation", includeFilters = {
//                @Filter(type = FilterType.CUSTOM, value = ColorBeanLoadFilter.class) }) })

//@EnableDemo
public class TestMystarterApplication {

    public static void main(String[] args) {
        SpringApplication.run(TestMystarterApplication.class, args);
    }

    @Autowired
    private DemoService demoService;

    @Autowired
    private TestService testService;

    @Autowired
    private DemoProperties demoProperties;
    @EventListener(ApplicationReadyEvent.class)
    public void onApplicationReady() {
        System.out.println("Application ready");
        demoService.test();
        System.out.println("Application ready 2");
        testService.test();
        System.out.println("Application ready 3");
        System.out.println(demoProperties.getName());
        System.out.println(demoProperties.getAliyun().getSignName());

        System.out.println("Application ready 4");
        DemoUtil.send("121", "151" , "abcdefg");

        System.out.println("Application ready end");
    }
}
